package com.xydpeng.rpc.protocol;

import com.xydpeng.rpc.common.model.FastRpcRequest;
import com.xydpeng.rpc.common.model.FastRpcResponse;
import io.netty.util.Recycler;

/**
 * @author xydpeng
 * @version v1.0
 * @date: 2023/4/14
 * @description:
 */
public class ObjectPools {
    private ObjectPools() {}

    public static final Recycler<FastRpcProtocol> fastRpcProtocolRecycler = new Recycler<FastRpcProtocol>() {
        @Override
        protected FastRpcProtocol newObject(Handle<FastRpcProtocol> handle) {
            return new FastRpcProtocol(handle);
        }
    };


    public static  final  Recycler<MsgHeader> msgHeaderRecycler = new Recycler<MsgHeader>() {
        @Override
        protected MsgHeader newObject(Handle<MsgHeader> handle) {
            return new MsgHeader(handle);
        }
    };


    public static  final  Recycler<FastRpcRequest> fastRpcRequestRecycler = new Recycler<FastRpcRequest>() {
        @Override
        protected FastRpcRequest newObject(Handle<FastRpcRequest> handle) {
            return new FastRpcRequest(handle);
        }
    };

    public static  final  Recycler<FastRpcResponse> fastRpcResponseRecycler = new Recycler<FastRpcResponse>() {
        @Override
        protected FastRpcResponse newObject(Handle<FastRpcResponse> handle) {
            return new FastRpcResponse(handle);
        }
    };




}
